import { ApiHideProperty, OmitType, PickType } from '@nestjs/swagger';

import { User } from '@/modules/app/entities';
import { IsOptional } from 'class-validator';

export class CreateUserDto extends PickType(User, [
  'phone',
  'password',
  'role',
]) {
  /**
   * 平台
   */
  @ApiHideProperty()
  @IsOptional()
  platform?: 'APP';
}

export class UpdateUserDto extends PickType(User, [
  'height',
  'weight',
  'gender',
  'birthDate',
  'totalPoint',
  'education',
  'comorbidities',
  'phone',
]) {}

export class LoginUserDto extends PickType(User, [
  'phone',
  'password',
  'role',
]) {}

export class UserResDto extends OmitType(User, [
  'password',
  'punch',
  'analyticsEvents',
  'messages',
  'points',
  'role',
]) {}

export class UserDetailDto extends OmitType(User, [
  'password',
  'punch',
  'analyticsEvents',
  'messages',
  'points',
  'relations',
  'receivedRelations'
]) {}
